package cn.wolfcode.p2p.base.domain;

import cn.wolfcode.p2p.base.util.BitStateUtil;
import lombok.Getter;
import lombok.Setter;

/**
 * Created by wolfcode on 2018/7/23.
 */
@Setter
@Getter
public class UserInfo extends BaseDomain {
	private int version;// 乐观锁
	private Long bitState = 0L;// 用户状态码
	private String realName;// 真实姓名
	private String idNumber;// 身份证号码
	private String phoneNumber;// 手机号码
	private String email;// 邮箱
	private SystemDictionaryItem incomeGrade;// 收入情况
	private SystemDictionaryItem marriage;// 婚姻情况
	private SystemDictionaryItem kidCount; // 子女情况
	private SystemDictionaryItem educationBackground;// 学历情况
	private SystemDictionaryItem houseCondition;// 住房情况

	private Long realAuthId;// 实名认证id
	private Long videoAuthId;// 视频认证id

	/**
	 * 添加状态吗方法
	 * 
	 * @param state
	 */
	public void addState(long state) {
		this.bitState = BitStateUtil.addState(this.bitState, state);
	}

	/**
	 * 去掉状态吗方法
	 * 
	 * @param state
	 */
	public void removeState(long state) {
		this.bitState = BitStateUtil.removeState(this.bitState, state);
	}

	/**
	 * 判断是否填写基本资料
	 * 
	 * @return
	 */
	public boolean getHasBasicInfo() {
		return BitStateUtil.hasState(this.bitState, BitStateUtil.OP_BASIC_INFO);
	}

	/**
	 * 判断是否实名认证
	 * 
	 * @return
	 */
	public boolean getHasRealAuth() {
		return BitStateUtil.hasState(this.bitState, BitStateUtil.OP_REAL_AUTH);
	}

	/**
	 * 判断是否视频认证
	 * 
	 * @return
	 */
	public boolean getHasVideoAuth() {
		return BitStateUtil.hasState(this.bitState, BitStateUtil.OP_VEDIO_AUTH);
	}

	/**
	 * 判断是否绑定银行卡
	 * 
	 * @return
	 */
	public boolean getHasBindBankInfo() {
		return BitStateUtil.hasState(this.bitState, BitStateUtil.OP_BIND_BANKINFO);
	}

	/**
	 * 是否有借款在审核流程当中
	 * 
	 * @return
	 */
	public boolean getHasBidRequestInProcess() {
		return BitStateUtil.hasState(this.bitState, BitStateUtil.HAS_BIDREQUEST_IN_PROCESS);
	}

	/**
	 * 是否有提现在审核流程当中
	 * 
	 * @return
	 */
	public boolean getHasWithdrawInProcess() {
		return BitStateUtil.hasState(this.bitState, BitStateUtil.HAS_WITHDRAW_IN_PROCESS);
	}
}
